package com.wisely.highlight_springmvc4;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
@Configuration//相当于<mvc:annotation-driven/> 
@EnableWebMvc//包含<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>
@ComponentScan(basePackages={"controller"})//相当于<context:component-scan base-package="Controller"/>      
public class DispatcherConfig   extends WebMvcConfigurerAdapter {
    @Bean
    public InternalResourceViewResolver viewResolver() {
        InternalResourceViewResolver resolver = new InternalResourceViewResolver();
        resolver.setPrefix("/WEB-INF/jsp/");
        resolver.setSuffix(".jsp");
        return resolver;
    }   
}
